package chixing.day16.class23;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class newq {

    public static void main(String[] args) {
     InputStream is =null;
        try {
            is=new FileInputStream("D:\\a\\a.txt");
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
     //读取
    byte[] byteArray;
        try {
            byteArray= new byte[is.available()];
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        int temp;
        int i=0;
        try{
        while((temp = is.read())!=-1)
            byteArray[i++] = (byte) temp;
        }catch (IOException e) {
            throw new RuntimeException(e);
        }
        finally{
            if(is != null){
                try {
                    is.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        String result = new String(byteArray);
        System.out.println(result);
    }
    }
